package com.zhongyu.item.consumer.elastic;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDate;
import java.time.LocalDateTime;


@Data
@Document(indexName = "item-index",type = "_doc")
public class ItemDoc {


    @Field(type=FieldType.Integer)
    private Integer areaId;

    @Field(type=FieldType.Keyword)
    private String areaName;          //dm_item数据库中dm_cinma表name

    @Field(type=FieldType.Text,analyzer = "ik_max_word")
    private String address;            //dm_item中dm_cinma剧场地址


    //format=DateFormat.date的格式为yyyy-MM-dd,此处的格式必须与ItemDto中的LocalDate的pattern保持一致
    @Field(type=FieldType.Date,format = DateFormat.date)
    private LocalDate startTime;         //开始时间

    //format=DateFormat.date的格式为yyyy-MM-dd,此处的格式必须与ItemDto中的LocalDate的pattern保持一致
    @Field(type=FieldType.Date,format = DateFormat.date)
    private LocalDate endTime;           //结束时间



    @Field(type=FieldType.Integer)
    private Integer itemTypeId1;  //itemid1Type

    @Field(type=FieldType.Integer)
    private Integer itemTypeId2; //itemid2Type


    //format=DateFormat.date的格式为yyyy-MM-dd,此处的格式必须与ItemDto中的LocalDate的pattern保持一致
    @Field(type=FieldType.Date,format = DateFormat.date)
    private LocalDate createdTime;







    //排序字段
    @Field(type=FieldType.Integer)
    private Integer isRecommend;


    @Id
    @Field(type= FieldType.Integer)
    private Integer id;



    @Field(type=FieldType.Keyword)
    private String imgUrl;            //dm_base数据库中dm_image表的图片路径


    @Field(type=FieldType.Text,analyzer = "ik_max_word")
    private String itemName;          //商品节目名称

    @Field(type=FieldType.Text,analyzer = "ik_max_word")
    private String abstractMessage;   //摘要信息



    @Field(type=FieldType.Float)
    private Double minPrice;           //最低价格

    @Field(type=FieldType.Float)
    private Double maxPrice;           //最高价格



    @Field(type=FieldType.Keyword)
    private String latitude;          //dm_item数据库中dm_cinma经度

    @Field(type=FieldType.Keyword)
    private String longitude;       //dm_item数据库中dm_cinma纬度

}
